{% extends 'index.html' %}
{% block body %}

        <table cellpadding="0" cellspacing="3" border="0">
            <tr style="">
                <th style="width:25px;">N.</th>
                <th style="width:100px;">OPERAZIONE</th>
                <th style="width:80px;" class="detail">DATA</th>
                <th style="width:auto;" class="detail">RAGIONE SOCIALE</th>
                <th style="width:70px;" class="detail">IMPONIBILE</th>
                <th style="width:70px;" class="detail">IMPOSTA</th>
                <th style="width:70px;" class="detail">TOTALE </th>
                <th style="width:70px;" class="detail">SOSPESO</th>
                <th style="width:70px;" class="detail">SALDATO</th>
                <th style="width:120px;" class="detail">TIPO PAGATO</th>
                <th style="width:140px;" class="detail">BANCA</th>
            </tr>
           {% for dao in pageData["objects"] %}
            {% set tota = dao.totali %}
            <tr style="" class="row">
                <td style="width:25px;text-align:center;font-size:10px;">{{dao.numero|string + ' ' + (dao.parte or '')|string}}</td>
                <td style="width:100px;text-align:center;font-size:10px;">{{dao.operazione}}</td>
                <td style="width:80px;text-align:center;font-size:10px;" class="detail">{{utils.dateToString(dao.data_documento)}}</td>
                <td style="width:auto;text-align:left;font-size:10px;" class="detail">{{dao.intestatario}}</td>
                <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(dao._totaleImponibile,2)}}</td>
                <td style="width:70px;text-align:right;font-size:10px;"class="detail">{{utils.mNLC(dao._totaleImposta,2)}}</td>
                <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(dao._totaleNonScontato,2)}}</td>
                {% if dao.documento_saldato == True %}
                    <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(0,2)}}</td>
                    <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(dao._totaleScontato,2)}}</td>
                {% else %}
                        <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(dao.totale_sospeso,2)}}</td>
                        <td style="width:70px;text-align:right;font-size:10px;" class="detail">{{utils.mNLC(dao.totale_pagato,2)}}</td>
                {% endif %}
                <td style="width:120px;text-align:center;font-size:10px;" class="detail">{{dao.pagamento}}</td>
                <td style="width:140px;text-align:center;font-size:10px;" class="detail">{{dao.banca[0:20]}}</td>
            </tr>
            {% endfor %}
            </table>
            <hr></hr><h2 align="center">TOTALI</h2>
            <table style="width:360px;">
            {% set tot = utils.calcolaTotali(pageData["objects"]) %}
            {% for k, v in tot['imponibile_aliquote'].items() %}
	            <tr>
	                <th style="width:200px;text-align:left;font-size:12px" >IMPONIBILE Aliquota {{ utils.mN(k, 0) }}%</th>
	                <td style="width:120px;text-align:right;font-size:12px" ><b>{{utils.mNLC(v, 2)}}</b></td>
	            </tr>
			{% endfor %}
            <tr>
                <th style="width:200px;text-align:left;font-size:12px" >IMPONIBILE. NON SCONTATO.</th>
                <td style="width:120px;text-align:right;font-size:12px" ><b>{{utils.mNLC(tot["totale_imponibile_non_scontato"],2)}}</b></td>
            </tr>
            {% for k, v in tot['imposta_aliquote'].items() %}
	            <tr>
	                <th style="width:200px;text-align:left;font-size:12px" >IMPOSTA Aliquota {{ utils.mN(k, 0) }}%</th>
	                <td style="width:120px;text-align:right;font-size:12px" ><b>{{utils.mNLC(v, 2)}}</b></td>
	            </tr>
			{% endfor %}
            <tr>
                <th style="width:200px;text-align:left;font-size:12px">IMPOSTA NON SCONTATA</th>
                <td style="width:120px;text-align:right;font-size:12px"><b>{{utils.mNLC(tot["totale_imposta_non_scontata"],2)}}</b></td>
            </tr>
             <tr>
                <th style="width:200px;text-align:left;font-size:12px">GENERALE NON SCONTATO </th>
                <td style="width:120px;text-align:right;font-size:12px"><b>{{utils.mNLC(tot["totale_non_scontato"],2)}}</b></td>
            </tr>
                        <tr><td></td></tr>
            <tr>
                <th style="width:200px;text-align:left;font-size:14px;">IMPONIBILE SCONTATO</th>
                <td style="width:120px;text-align:right;font-size:14px;"><b>{{utils.mNLC(tot["totale_imponibile_scontato"],2)}}</b></td>
            </tr>
            <tr>
                <th style="width:200px;text-align:left;font-size:14px;" >IMPOSTA SCONTATA </th>
                <td style="width:120px;text-align:right;font-size:14px;"><b>{{utils.mNLC(tot["totale_imposta_scontata"],2)}}</b></td>
            </tr>
                <th style="width:200px;text-align:left;font-size:16px;">GENERALE SCONTATO</th>
                <td style="width:120px;text-align:right;font-size:16px;"><b>{{utils.mNLC(tot["totale_scontato"],2)}}</b></td>
            </tr>
            <tr><td></td></tr>
           <tr>
                <th style="width:200px;text-align:left;font-size:12px">SOSPESO</th>
                <td style="width:120px;text-align:right;font-size:12px"><b>{{utils.mNLC(tot["totale_sospeso"],2)}}</b></td>
            </tr>
            <tr>
                <th style="width:200px;text-align:left;font-size:12px">PAGATO</th>
                <td style="width:120px;text-align:right;font-size:12px"><b>{{utils.mNLC(tot["totale_pagato"],2)}}</b></td>
            </tr>
        </table>
{% endblock %}
